﻿﻿@using FCZLM.Core.Models

@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Add</title>
    <link href="/layui/css/layui.css" rel="stylesheet" />
</head>
<body>
    <div>
        <div class="layui-card">
            <div class="layui-card-header">添加角色</div>
            <div class="layui-card-body">
                <form class="layui-form">
                    <div class="layui-form-item">
                        <label class="layui-form-label">角色名字</label>
                        <div class="layui-input-block">
                            <input type="text" name="RoleName" required lay-verify="required" placeholder="请输入名字" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">角色说明</label>
                        <div class="layui-input-block">
                            <input type="text" name="Desc" required lay-verify="required" placeholder="请输入内容" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit lay-filter="Addform">添加</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <script src="/layui/layui.js"></script>
    <script>
        layui.use(["form", 'layer'], function () {
            var form = layui.form;
            var $ = layui.$;
            var layer = layui.layer;
            //提交
            form.on('submit(Addform)', function (data) {
                $.post("/frole/add", data.field, function (res) {
                    if (res.isSuccess) {
                        layer.msg(res.msg, function () {
                            parent.window.location.href = "/frole/index";
                        });
                    } else {
                        layer.msg(res.msg);
                    }
                });
                return false;
            });
        });
    </script>
</body>
</html>
